
class floorButton{
	private int floor;
	private String direction;//up or down;
	private elevator e;
	public floorButton(){
		
	}
	public void callOut(person p,elevator e){
		//direction = "up";
		if(e.direction=="stay") new eleThread(e,p).start();
		
		else{
			if(p.getTargetFloor()>e.targetFloor){
				e.go[e.targetFloor] = 1;
				e.targetFloor = p.getTargetFloor();
			}
			else e.go[p.getTargetFloor()] = 1;
		}
		
		//new eleThread(e,p).start();
	}
	public int getFloor(){
		return floor;
	}
	public void setFloor(int da){
		this.floor = da;
	}
}

class eleThread extends Thread{
	elevator e;
	person p;
	public eleThread(elevator e,person p){
		this.e = e;
		this.p = p;
	}
	public void run(){
		try{
			e.call(p);
		}
		catch(Exception ex){

		}
	}
}